<template>
  <div class="container" @click="hiddenGallary">
    <div class="wrapper">
      <swiper :options="swiperOptions">
        <swiper-slide v-for="(img, index) in imgs" :key="index">
          <div class="img-wrapper">
            <img class="gallary-img" :src="img">
          </div>
        </swiper-slide>
        <div class="swiper-pagination" slot="pagination"></div>
      </swiper>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    imgs: Array
  },
  data () {
    return {
      swiperOptions: {
        pagination: {
          el: '.swiper-pagination',
          type: 'fraction'
        },
        loop: true,
        observeParents: true,
        observer: true
      }
    }
  },
  methods: {
    hiddenGallary () {
      this.$emit('hiddenGallary')
      document.documentElement.style.overflow = 'visible'
    }
  }
}
</script>

<style lang='stylus' rel='stylesheet/stylus' scoped>
    .container >>> .swiper-container
      overflow visible
      color #fff
  .container >>> .swiper-pagination-fraction
    overflow visible
    position relative
    bottom -1rem
  .container
    display flex
    flex-direction column
    justify-content center
    position fixed
    top 0
    left 0
    right 0
    bottom 0
    z-index 99
    height 100%
    background #000
    .wrapper
      width 100%
      height 0
      padding-bottom 100%
      .img-wrapper
        overflow hidden
        width 100%
        height 0
        padding-bottom 100%
        .gallary-img
          width 100%
</style>
